Memory leaks refer to the fact that memory continues to be retained by the program using it even though it is no longer needed. Despite the use of garbage collection, memory leaks frequently occur in JAVA program applications. A JAVA memory leak occurs when there are references to an object that will not be used again by the application. Because the application won't use the object while the object occupies memory, the object is a waste of memory. For example, an application may create temporary objects during a J2EE transaction and inadvertently cache references to these objects that cause the objects to be retained permanently, i.e., causing memory leaks. As a result, each time the application performs a transaction, a little more memory is lost. Eventually, the application crashes due to out of memory.
Problems related to memory leaks become worse when they occur in deployed web applications, i.e., those that are actively serving customers. This is because constraints arise in solving those problems. For example, system performance degradation is kept to minimum for analyzing memory leak of running applications; the application should not pause for several seconds; problem analysis cannot require large amounts of memory, etc. Additionally, operators of data centers where web applications are frequently hosted do not typically have sophisticated debugging knowledge, and they must diagnose the problem quickly. Therefore, it is necessary for them to be told exactly where memory leaks may be occurring as soon as those leaks begin.
Existing solutions to deal with memory leaks are numerous, but they each have their own shortcomings. For example, they may be too intrusive to the application and/or do not give the user enough information. They can only find memory leaks in a fraction of the application data. They require user interaction, storage of information about each object, large amounts of memory to produce heap snapshots, heap dumps that are computationally expensive and cannot be used in deployed applications, etc.